package state.group.events;

import messages.ByteList;

public class PersonDispatcherEvent extends BaseEvent {
    
    private byte isRegistration;
    
    public PersonDispatcherEvent(byte[] data, int startIndex)
    {
        isRegistration = data[startIndex + 1];
    }
    
    public PersonDispatcherEvent(boolean isRegistration)
    {
        this.isRegistration = (byte) (isRegistration ? 1 : 0);
    }
    
    public boolean isRegistration()
    {
        return isRegistration == 1;
    }
    
    @Override
    public void appendToByteList(ByteList list)
    {
        super.appendToByteList(list);
        list.addByte(isRegistration);
    }
    
    @Override
    public int getEventByteLength()
    {
        return 2;
    }

    @Override
    public EventType getEventType()
    {
        return EventType.PersonDispatcherEvent;
    }

}
